/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package vlcj.tutorial2;

import com.sun.jna.Native;
import com.sun.jna.NativeLibrary;
import java.io.File;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import uk.co.caprica.vlcj.binding.LibVlc;
import uk.co.caprica.vlcj.component.EmbeddedMediaPlayerComponent;
import uk.co.caprica.vlcj.runtime.RuntimeUtil;

/**
 *
 * @author manoelneto
 */
public class Tutorial2 {
    
  public Tutorial2(String args) {
    JFrame frame = new JFrame("vlcj Tutorial");
    mediaPlayerComponent = new EmbeddedMediaPlayerComponent();

    frame.setContentPane(mediaPlayerComponent); 
    frame.setLocation(100, 100);
    frame.setSize(1050, 600);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);
    String vt[]={args};
    System.out.println(args);
    mediaPlayerComponent.getMediaPlayer().playMedia(vt[0]);
  }
    private EmbeddedMediaPlayerComponent mediaPlayerComponent=null;
    public static void main(final String[] args) {
     NativeLibrary.addSearchPath(
      RuntimeUtil.getLibVlcLibraryName(), "c:\\Program Files\\VideoLAN\\VLC"
    );
    Native.loadLibrary(RuntimeUtil.getLibVlcLibraryName(), LibVlc.class);
        
        JFileChooser j=new JFileChooser();
        j.showOpenDialog(null);
        final File f=j.getSelectedFile();
     
    SwingUtilities.invokeLater(new Runnable() {
      @Override
      public void run() {
                Tutorial2 tutorial2 = new Tutorial2(f.getPath());
      }
    });
  }
}
  
    

